<?php
namespace app\circle\logic;
use app\circle\validate\WorkCircleMsg as WorkCircleMsgValidate;

class CircleMsgLogic extends BaseLogic {

    /**
     * 获取工作圈消息查询条件
     * @return array
     */
    public function ajax_get_wcm_maps(){
        $maps = [];
        return $maps;
    }


    /**
     * 检查发布工作圈消息规则
     * @param $params
     * @return mixed
     */
    public function check_send_wcm_rule($params){
        $validate = new WorkCircleMsgValidate();
        $r = $validate->scene('add')->check($params);
        if(!$r){
            return $this->get_response(0,$validate->getError());
        }
        //图片安全监测
        
        return $this->get_response(1,'OK');
    }

    /**
     * 检查置顶工作圈消息规则
     * @param $openid
     * @param $params
     * @return mixed
     */
    public function check_is_top_wcm_rule($openid,$params){
        $maps = [];
        $maps[] = ['id','=',$params['wcmid']];
        $maps[] = ['openid','=',$openid];
        $wcm_detail = model('work_circle_msg')->get_detail($maps,'id');
        if(empty($wcm_detail)){
            return $this->get_response(0,'该工作圈消息不存在');
        }

        $data['wcm_detail'] = $wcm_detail;
        return $this->get_response(1,'OK',$data);
    }
}